-------------------------------------------------------------------------------
--
-------------------------------------------------------------------------------
require"luarocks.require"
require"luasql.mysql"
require"recaptcha"

dofile"common.lua"

-------------------------------------------------------------------------------
-- Register a new user in the database with status = ACTIVE
-------------------------------------------------------------------------------
function updateUserConfirm(userID) 
	local executionStr = string.format([[UPDATE master_peer SET status = '%s', timeStart = '%s' WHERE userID = '%d']], "INACTIVE", "0", tonumber(userID))
	local execution = db_Execute (executionStr)
end

-------------------------------------------------------------------------------
-- Update new password for userID
-------------------------------------------------------------------------------
function updateChangePassword(userID, password)
	local executionStr = string.format([[UPDATE master_peer SET password = '%s' WHERE userID = '%d']], tostring(password), tonumber(userID))
	local execution = db_Execute (executionStr)
end

-------------------------------------------------------------------------------
-- Delete a user existe in the database of master_peer
-------------------------------------------------------------------------------
function deleteUserID(userID, password)
	local executionStr = string.format([[DELETE FROM master_peer WHERE userID = '%d' and password = '%s']], tonumber(userID), tostring(password))
	local execution = db_Execute (executionStr)
end